package mysql

import "gorm.io/gorm"

type Comment struct {
	gorm.Model
	UserId  int    `gorm:"column:user_id;type:int;not null;comment:用户ID"`
	ClassId int    `gorm:"column:class_id;type:int;not null;comment:课程ID"`
	Comment string `gorm:"column:comment;type:varchar(200);not null;comment:评论内容"`
	Status  int    `gorm:"column:status;type:int;not null;comment:状态"`
}

// 添加评论
func (c *Comment) CreateComment() error {
	return DB.Create(&c).Error
}
